Figure 2. Standardized regression coefficients for cognitive outcomes with neural flexibility.
- All regression is controlled for age, sex, education
figure by gamma (omega=1, window size=30)
figdat=rbind(data.frame(fits1[[4]], ws=0.2),data.frame(fits1[[5]], ws=0.7),data.frame(fits1[[1]], ws=1),
data.frame(fits1[[6]], ws=1.2),data.frame(fits1[[7]], ws=1.7)) %>%
mutate(condition = factor(substr(xvar,1,1), levels=c('r','t'), labels=c('rest','task')),
network = substr(gsub('task.','',gsub('rs.','',xvar)),1,4),
sig=factor(ifelse(pval<0.05,'p<0.05','N.S')),
sig.adjust=factor(ifelse(p.adjust<0.05,'p.adjust<0.05','N.S'))) %>%
mutate(gamma=factor(ws), ws=30)
ggplot(figdat, aes(x=network, y=beta)) +
geom_line(aes(group=gamma, linetype=gamma),size=1)+
geom_errorbar(aes(ymin=CI95.2.5.., ymax=CI95.97.5..,colour=sig), alpha=0.2) +
facet_grid(yvar~condition, scales="free_y") +
geom_hline(yintercept=0, colour='red')+
geom_point(aes(colour=sig, shape=sig), size=3) +
theme_base()

#figdat %>% filter(pval<0.05) %>% kable(., digits=3) %>% kable_classic()
figure by omega (gamma=1, window size=30)
figdat=rbind(data.frame(fits1[[8]], ws=0.2),data.frame(fits1[[9]], ws=0.7),data.frame(fits1[[1]], ws=1),
data.frame(fits1[[10]], ws=1.2),data.frame(fits1[[11]], ws=1.7)) %>%
mutate(condition = factor(substr(xvar,1,1), levels=c('r','t'), labels=c('rest','task')),
network = substr(gsub('task.','',gsub('rs.','',xvar)),1,4),
sig=factor(ifelse(pval<0.05,'p<0.05','N.S')),
sig.adjust=factor(ifelse(p.adjust<0.05,'p.adjust<0.05','N.S')))%>%
mutate(omega=factor(ws)) %>%
mutate(ws=30)
ggplot(figdat , aes(x=network, y=beta)) +
geom_line(aes(group=omega, linetype=omega),size=1)+
geom_errorbar(aes(ymin=CI95.2.5.., ymax=CI95.97.5..,colour=sig), alpha=0.2) +
facet_grid(yvar~condition, scales="free_y") +
geom_hline(yintercept=0, colour='red')+
geom_point(aes(colour=sig, shape=sig), size=3) +
theme_base()

#figdat %>% filter(pval<0.05) %>% kable(., digits=3) %>% kable_classic()
Figure 3. Standardized regression coefficients for moderation of cognitive Aging.
figure by gamma (omega=1, window size=30)
figdat=rbind(data.frame(fits1[[4]], ws=0.2),
data.frame(fits1[[5]], ws=0.7),data.frame(fits1[[1]], ws=1),
data.frame(fits1[[6]], ws=1.2),data.frame(fits1[[7]], ws=1.7)) %>%
mutate(condition = factor(substr(xvar,1,1), levels=c('r','t'), labels=c('rest','task')),
network = substr(gsub('task.','',gsub('rs.','',xvar)),1,4),
sig=factor(ifelse(pval<0.05,'p<0.05','N.S')),
sig.adjust=factor(ifelse(p.adjust<0.05,'p.adjust<0.05','N.S'))) %>%
mutate(gamma=factor(ws), ws=30)
ggplot(figdat, aes(x=network, y=beta)) +
geom_line(aes(group=gamma, linetype=gamma),size=1)+
geom_errorbar(aes(ymin=CI95.2.5.., ymax=CI95.97.5..,colour=sig), alpha=0.2) +
facet_grid(yvar~condition, scales="free_y") +
geom_hline(yintercept=0, colour='red')+
geom_point(aes(colour=sig, shape=sig), size=3) +
theme_base()

figdat %>% filter(pval<0.05) %>% kable(., digits=3) %>% kable_classic()
|
|
yvar
|
xvar
|
beta
|
CI95.2.5..
|
CI95.97.5..
|
pval
|
p.adjust
|
ws
|
condition
|
network
|
sig
|
sig.adjust
|
gamma
|
|
61421
|
NPMemory
|
task.CON
|
-0.143
|
-0.242
|
-0.044
|
0.005
|
0.822
|
30
|
task
|
CON
|
p<0.05
|
N.S
|
0.7
|
|
62021
|
NPMemory
|
task.SMNh
|
-0.112
|
-0.216
|
-0.008
|
0.035
|
0.967
|
30
|
task
|
SMNh
|
p<0.05
|
N.S
|
0.7
|
|
62121
|
NPMemory
|
task.SMNm
|
-0.126
|
-0.225
|
-0.028
|
0.012
|
0.967
|
30
|
task
|
SMNm
|
p<0.05
|
N.S
|
0.7
|
|
61962
|
MatReas_medianCorRT.log
|
task.SN
|
0.119
|
0.009
|
0.228
|
0.034
|
1.000
|
30
|
task
|
SN
|
p<0.05
|
N.S
|
1
|
|
62362
|
MatReas_medianCorRT.log
|
task.Visual
|
0.138
|
0.024
|
0.251
|
0.017
|
1.000
|
30
|
task
|
Visu
|
p<0.05
|
N.S
|
1
|
|
6314
|
NPSpeed_attention
|
rs.DAN
|
-0.113
|
-0.224
|
-0.002
|
0.045
|
0.759
|
30
|
rest
|
DAN
|
p<0.05
|
N.S
|
1.2
|
|
679
|
NPSpeed_attention
|
rs.SN
|
-0.137
|
-0.243
|
-0.031
|
0.011
|
0.386
|
30
|
rest
|
SN
|
p<0.05
|
N.S
|
1.2
|
|
6149
|
NPSpeed_attention
|
task.CON
|
-0.095
|
-0.187
|
-0.003
|
0.042
|
0.759
|
30
|
task
|
CON
|
p<0.05
|
N.S
|
1.2
|
|
61323
|
NPMemory
|
task.AUD
|
-0.130
|
-0.237
|
-0.023
|
0.018
|
0.498
|
30
|
task
|
AUD
|
p<0.05
|
N.S
|
1.2
|
|
61423
|
NPMemory
|
task.CON
|
-0.125
|
-0.222
|
-0.029
|
0.011
|
0.386
|
30
|
task
|
CON
|
p<0.05
|
N.S
|
1.2
|
|
62023
|
NPMemory
|
task.SMNh
|
-0.138
|
-0.238
|
-0.037
|
0.007
|
0.386
|
30
|
task
|
SMNh
|
p<0.05
|
N.S
|
1.2
|
|
62123
|
NPMemory
|
task.SMNm
|
-0.098
|
-0.196
|
0.000
|
0.050
|
0.759
|
30
|
task
|
SMNm
|
p<0.05
|
N.S
|
1.2
|
|
62223
|
NPMemory
|
task.VAN
|
-0.132
|
-0.231
|
-0.033
|
0.009
|
0.386
|
30
|
task
|
VAN
|
p<0.05
|
N.S
|
1.2
|
|
61143
|
NPVocab
|
rs.AUD
|
-0.137
|
-0.243
|
-0.031
|
0.011
|
0.386
|
30
|
rest
|
AUD
|
p<0.05
|
N.S
|
1.2
|
|
61333
|
NPVocab
|
task.AUD
|
0.113
|
0.004
|
0.221
|
0.042
|
0.759
|
30
|
task
|
AUD
|
p<0.05
|
N.S
|
1.2
|
|
6653
|
MatReas_NumCor
|
rs.MRN
|
-0.144
|
-0.272
|
-0.016
|
0.028
|
0.674
|
30
|
rest
|
MRN
|
p<0.05
|
N.S
|
1.2
|
|
61410
|
NPSpeed_attention
|
task.CON
|
-0.094
|
-0.188
|
0.000
|
0.049
|
0.947
|
30
|
task
|
CON
|
p<0.05
|
N.S
|
1.7
|
|
61124
|
NPMemory
|
rs.AUD
|
0.139
|
0.035
|
0.244
|
0.009
|
0.947
|
30
|
rest
|
AUD
|
p<0.05
|
N.S
|
1.7
|
|
62254
|
MatReas_NumCor
|
task.VAN
|
-0.116
|
-0.221
|
-0.011
|
0.030
|
0.947
|
30
|
task
|
VAN
|
p<0.05
|
N.S
|
1.7
|
figure by omega (gamma=1, window size=30)
figdat=rbind(data.frame(fits1[[8]], ws=0.2),data.frame(fits1[[9]], ws=0.7),data.frame(fits1[[1]], ws=1),
data.frame(fits1[[10]], ws=1.2),data.frame(fits1[[11]], ws=1.7)) %>%
mutate(condition = factor(substr(xvar,1,1), levels=c('r','t'), labels=c('rest','task')),
network = substr(gsub('task.','',gsub('rs.','',xvar)),1,4),
sig=factor(ifelse(pval<0.05,'p<0.05','N.S')),
sig.adjust=factor(ifelse(p.adjust<0.05,'p.adjust<0.05','N.S')))%>%
mutate(omega=factor(ws)) %>%
mutate(ws=30)
ggplot(figdat , aes(x=network, y=beta)) +
geom_line(aes(group=omega, linetype=omega),size=1)+
geom_errorbar(aes(ymin=CI95.2.5.., ymax=CI95.97.5..,colour=sig), alpha=0.2) +
facet_grid(yvar~condition, scales="free_y") +
geom_hline(yintercept=0, colour='red')+
geom_point(aes(colour=sig, shape=sig), size=3) +
theme_base()

figdat %>% filter(pval<0.05) %>% kable(., digits=3) %>% kable_classic()
|
|
yvar
|
xvar
|
beta
|
CI95.2.5..
|
CI95.97.5..
|
pval
|
p.adjust
|
ws
|
condition
|
network
|
sig
|
sig.adjust
|
omega
|
|
62231
|
NPVocab
|
task.VAN
|
0.109
|
0.006
|
0.212
|
0.039
|
0.960
|
30
|
task
|
VAN
|
p<0.05
|
N.S
|
0.7
|
|
61962
|
MatReas_medianCorRT.log
|
task.SN
|
0.119
|
0.009
|
0.228
|
0.034
|
1.000
|
30
|
task
|
SN
|
p<0.05
|
N.S
|
1
|
|
62362
|
MatReas_medianCorRT.log
|
task.Visual
|
0.138
|
0.024
|
0.251
|
0.017
|
1.000
|
30
|
task
|
Visu
|
p<0.05
|
N.S
|
1
|
|
61423
|
NPMemory
|
task.CON
|
-0.138
|
-0.235
|
-0.041
|
0.005
|
0.891
|
30
|
task
|
CON
|
p<0.05
|
N.S
|
1.2
|
|
62223
|
NPMemory
|
task.VAN
|
-0.113
|
-0.212
|
-0.014
|
0.026
|
0.981
|
30
|
task
|
VAN
|
p<0.05
|
N.S
|
1.2
|
|
61763
|
MatReas_medianCorRT.log
|
task.FPN
|
0.110
|
0.001
|
0.220
|
0.049
|
0.981
|
30
|
task
|
FPN
|
p<0.05
|
N.S
|
1.2
|
|
62224
|
NPMemory
|
task.VAN
|
-0.128
|
-0.223
|
-0.032
|
0.009
|
0.749
|
30
|
task
|
VAN
|
p<0.05
|
N.S
|
1.7
|
|
61144
|
NPVocab
|
rs.AUD
|
-0.124
|
-0.228
|
-0.020
|
0.020
|
0.982
|
30
|
rest
|
AUD
|
p<0.05
|
N.S
|
1.7
|
|
6754
|
MatReas_NumCor
|
rs.SN
|
-0.189
|
-0.321
|
-0.056
|
0.005
|
0.749
|
30
|
rest
|
SN
|
p<0.05
|
N.S
|
1.7
|
|
61864
|
MatReas_medianCorRT.log
|
task.MRN
|
0.122
|
0.013
|
0.230
|
0.028
|
0.982
|
30
|
task
|
MRN
|
p<0.05
|
N.S
|
1.7
|
Variance
### figure by windown size (omega=1, gamma=1)
figdat=rbind(data.frame(fits.var[[1]], ws=30),data.frame(fits.var[[2]], ws=20),data.frame(fits.var[[3]], ws=40)) %>%
mutate(networks = substr(networks,1,4))
a1<-ggplot(figdat %>% mutate(ws=factor(ws)), aes(x=networks, y=var.ratio)) +
geom_line(aes(group=ws, linetype=ws),size=1)+
geom_errorbar(aes(ymin=ci.1, ymax=ci.2,colour=sig), alpha=0.2)+
geom_hline(yintercept=1, colour='red')+
geom_point(aes(colour=sig, shape=sig), size=3) +
theme_base()+
theme(legend.position='bottom') +
ggtitle('By window size (omega=1, gamma=1)')
#figdat %>% filter(pvalue<0.05) %>%
# select(networks, Cohens_d, diff, text) %>% kable(., digits=3) %>% kable_classic()
### figure by gamma (omega=1, window size=30)
figdat=rbind(#data.frame(fits.mean[[4]], ws=0.2),
data.frame(fits.var[[5]], ws=0.7),data.frame(fits.var[[1]], ws=1),
data.frame(fits.var[[6]], ws=1.2),data.frame(fits.var[[7]], ws=1.7)) %>%
mutate(networks = substr(networks,1,4)) %>%
mutate(gamma=factor(ws), ws=30)
a2<-ggplot(figdat, aes(x=networks, y=var.ratio)) +
geom_line(aes(group=gamma, linetype=gamma),size=1)+
geom_errorbar(aes(ymin=ci.1, ymax=ci.2,colour=sig), alpha=0.2)+
geom_hline(yintercept=1, colour='red')+
geom_point(aes(colour=sig, shape=sig), size=3) +
theme_base()+
theme(legend.position='bottom') +
ggtitle('By gamma (2indow size=30, omega=1)')
#figdat %>% filter(pvalue<0.05) %>%
# select(networks, Cohens_d, diff, text) %>% kable(., digits=3) %>% kable_classic()
### figure by omega (gamma=1, window size=30)
figdat=rbind(data.frame(fits.var[[8]], ws=0.2),data.frame(fits.var[[9]], ws=0.7),data.frame(fits.var[[1]], ws=1),
data.frame(fits.var[[10]], ws=1.2),data.frame(fits.var[[11]], ws=1.7)) %>%
mutate(networks = substr(networks,1,4)) %>%
mutate(omega=factor(ws), ws=30)
a3<-ggplot(figdat, aes(x=networks, y=var.ratio)) +
geom_line(aes(group=omega, linetype=omega),size=1)+
geom_errorbar(aes(ymin=ci.1, ymax=ci.2,colour=sig), alpha=0.2)+
geom_hline(yintercept=1, colour='red')+
geom_point(aes(colour=sig, shape=sig), size=3) +
theme_base()+
theme(legend.position='bottom') +
ggtitle('By omega (2indow size=30, gamma=1)')
#figdat %>% filter(pvalue<0.05) %>%
# select(networks, Cohens_d, diff, text) %>% kable(., digits=3) %>% kable_classic()
grid.arrange(a1,a2,a3,ncol=1)
